package com.weaver;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class CompareUtil {
    public static void main(String[] args) throws Exception {
        String source = "E:\\auto\\86e989f365be41a58d163cb2d563ff8c\\minRev\\S上海蓝书信息";
        String target = "E:\\auto\\86e989f365be41a58d163cb2d563ff8c\\maxRev\\S上海蓝书信息";

        String source2 = "E:\\auto\\86e989f365be41a58d163cb2d563ff8c\\minRev\\R软控股份";
        String target2 = "E:\\auto\\86e989f365be41a58d163cb2d563ff8c\\maxRev\\R软控股份";

        String path = "E:\\auto\\a40aaf4041ff4c5d914b0c2ed8048a43\\minRev\\S上海蓝书信息";
        String path2 = "E:\\auto\\a40aaf4041ff4c5d914b0c2ed8048a43\\maxRev\\S上海蓝书信息";
//        boolean b = compareFile(source, target, source2, target2);
        boolean b = compareFile("E:\\project\\svn\\file\\1", "E:\\project\\svn\\file\\2");
        System.out.println(b);
    }


    public static boolean compareFile(String source, String target, String source2, String target2) {
        boolean sourceResult = FileUtil.checkDirectory(source, source2, 0);
        boolean targetResult = FileUtil.checkDirectory(target, target2, 0);
        if (sourceResult && targetResult) {
            boolean b = FileUtil.checkAllFile(FileUtil.getFileList(source), FileUtil.getFileList(target), FileUtil.getFileList(source2),
                    FileUtil.getFileList(target2));

            boolean b1 = FileUtil.checkAllFile(FileUtil.getFileList(target), FileUtil.getFileList(source), FileUtil.getFileList(target2),
                    FileUtil.getFileList(source2));

            return b & b1;
        }
        return false;
    }

    public static boolean compareFile(String source, String target) {
        return FileUtil.checkDirectory(source, target, 1);
    }


}
